<!DOCTYPE html>
<html class="x-admin-sm" lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改大学生简历信息</title>
    <meta content="webkit" name="renderer">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <link rel="stylesheet" th:href="@{/layui/css/font.css}">
    <link rel="stylesheet" th:href="@{/layui/css/xadmin.css}">
    <link rel="stylesheet" th:href="@{/layui/css/login.css}">
    <script charset="utf-8" th:src="@{/layui/lib/layui/layui.js}" type="text/javascript"></script>
    <script th:src="@{/layui/js/xadmin.js}" type="text/javascript"></script>
</head>
<body class="login-bg">
<div class="layui-fluid">
    <div class="layui-row" style="width: 740px;margin: 70px auto auto;">
        <form class="layui-form" enctype="multipart/form-data" id="fm" style="padding: 30px 20px;background: white;border-radius: 20px">
            <div style="display: none">
                <label>
                    <input name="id" th:value="${resume.id}">
                </label>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="language">语言能力&emsp;</label>
                <div class="layui-input-inline">
                    <input class="layui-input" id="language" lay-verify="required" name="language" style="width: 530px" th:value="${resume.language}" type="text">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="strength">优势强项&emsp;</label>
                <div class="layui-input-inline">
                    <input class="layui-input" id="strength" lay-verify="required" name="strength" style="width: 530px" th:value="${resume.strength}" type="text">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="supMinSalary">期望薪资&emsp;</label>
                <div class="layui-input-inline">
                    <input class="layui-input" id="supMinSalary" lay-verify="required" name="supMinSalary" style="" th:value="${resume.supMinSalary}" type="text">
                </div>
                <label class="layui-form-label" for="supMaxSalary" style="width: 25px;position: relative;bottom: 7px;right: 5px">——</label>
                <div class="layui-input-inline">
                    <input class="layui-input" id="supMaxSalary" lay-verify="required" name="supMaxSalary" style="" th:value="${resume.supMaxSalary}" type="text">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="cityName">工作地点&emsp;</label>
                <div class="layui-input-inline">
                    <select id="cityName" lay-verify="required" name="city.id">
                        <option th:value="${resume.city.id}">[[${resume.city.cityName}]]</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="industryName">工作行业&emsp;</label>
                <div class="layui-input-inline">
                    <select id="industryName" lay-verify="required" name="industry.id">
                        <option th:value="${resume.industry.id}">[[${resume.industry.industryName}]]</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="jobName">工作职业&emsp;</label>
                <div class="layui-input-inline">
                    <select id="jobName" lay-verify="required" name="job.id">
                        <option th:value="${resume.job.id}">[[${resume.job.jobName}]]</option>
                    </select>
                </div>
            </div>

            <button class="layui-btn" id="L_repass" lay-filter="edit" lay-submit
                    style="width: 100%" type="submit">修改信息</button>
        </form>
    </div>
</div>

<script>
    layui.use([ 'form', 'layer', 'laydate', 'jquery', 'upload' ], function() {
        const form = layui.form, layer = layui.layer,
            $ = layui.jquery;
        // 获取下拉框信息 (行业分类信息)
        $.get("/industry_option_message",{},function (data) {
            let list = data;
            const select = document.getElementById('industryName');
            if (list != null) {
                for (let c in list) {
                    let option = document.createElement("option");
                    option.setAttribute("value", list[c].id);
                    option.innerText = list[c].industryName;
                    select.appendChild(option)
                }
            }
            form.render('select');
        },"json");
        // 获取下拉框信息 (职业信息)
        $.get("/job_option_message",{},function (data) {
            let list = data;
            const select = document.getElementById('jobName');
            if (list != null) {
                for (let c in list) {
                    let option = document.createElement("option");
                    option.setAttribute("value", list[c].id);
                    option.innerText = list[c].jobName;
                    select.appendChild(option)
                }
            }
            form.render('select');
        },"json");
        // 获取下拉框信息 (市级信息)
        $.get("/city_option_message",{},function (data) {
            let list = data;
            const select = document.getElementById('cityName');
            if (list != null) {
                for (let c in list) {
                    let option = document.createElement("option");
                    option.setAttribute("value", list[c].id);
                    option.innerText = list[c].cityName;
                    select.appendChild(option)
                }
            }
            form.render('select');
        },"json");
        //监听提交
        form.on('submit(edit)', function(data) {
            $.ajax({
                url : "/admin_student_resume_message_save_or_edit",
                method : 'post',
                data : data.field,
                dataType : 'JSON',
                success : function(res) {
                    if (res.code === 0) {
                        //弹出提示，并在1秒后进行跳转
                        layer.alert("修改成功", {
                            icon : 6
                        }, function() {
                            //关闭当前frame
                            xadmin.close();

                            // 可以对父窗口进行刷新
                            xadmin.father_reload();
                            return false;
                        });
                    } else {
                        layer.msg("修改失败:" + res.msg);
                        return false;
                    }
                }
            });
            return false;
        });
    })
</script>
</body>
</html>